home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / widget / nsIMenuItem.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  172 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsIMenuItem_h__
  39. #define nsIMenuItem_h__
  40.  
  41. #include "prtypes.h"
  42. #include "nsISupports.h"
  43. #include "nsString.h"
  44.  
  45. #include "nsIDocShell.h"
  46. #include "nsIDOMElement.h"
  47.  
  48.  
  49. // {f2e79600-1700-11d5-bb6f-90f240fe493c}
  50. #define NS_IMENUITEM_IID      \
  51. { 0xf2e79600, 0x1700, 0x11d5, \
  52.   { 0xbb, 0x6f, 0x90, 0xf2, 0x40, 0xfe, 0x49, 0x3c } };
  53.  
  54. class nsIMenu;
  55. class nsIWidget;
  56. class nsIMenuListener;
  57. class nsIChangeManager;
  58. class nsIContent;
  59.  
  60. enum {
  61.   knsMenuItemNoModifier      = 0,
  62.   knsMenuItemShiftModifier   = (1 << 0),
  63.   knsMenuItemAltModifier     = (1 << 1),
  64.   knsMenuItemControlModifier = (1 << 2),
  65.   knsMenuItemCommandModifier = (1 << 3)
  66. };
  67.  
  68. /**
  69.  * MenuItem widget
  70.  */
  71. class nsIMenuItem : public nsISupports {
  72.  
  73.   public:
  74.     NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_IID)
  75.  
  76.     enum EMenuItemType { eRegular = 0, eCheckbox, eRadio } ;
  77.  
  78.    /**
  79.     * Creates the MenuItem
  80.     *
  81.     */
  82.     NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool isSeparator, 
  83.                           EMenuItemType aItemType, PRBool aEnabled, 
  84.                           nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) = 0;
  85.     
  86.    /**
  87.     * Get the MenuItem label
  88.     *
  89.     */
  90.     NS_IMETHOD GetLabel(nsString &aText) = 0;
  91.  
  92.    /**
  93.     * Set the Menu shortcut char
  94.     *
  95.     */
  96.     NS_IMETHOD SetShortcutChar(const nsString &aText) = 0;
  97.   
  98.     /**
  99.     * Get the Menu shortcut char
  100.     *
  101.     */
  102.     NS_IMETHOD GetShortcutChar(nsString &aText) = 0;
  103.  
  104.    /**
  105.     * Gets whether the item is enabled or disabled
  106.     *
  107.     */
  108.     NS_IMETHOD GetEnabled(PRBool *aIsEnabled) = 0;
  109.  
  110.    /**
  111.     * Sets whether the item is checked or not
  112.     *
  113.     */
  114.     NS_IMETHOD SetChecked(PRBool aIsEnabled) = 0;
  115.  
  116.    /**
  117.     * Gets whether the item is checked or not
  118.     *
  119.     */
  120.     NS_IMETHOD GetChecked(PRBool *aIsEnabled) = 0;
  121.  
  122.    /**
  123.     * Gets whether the item is a checkbox or radio
  124.     *
  125.     */
  126.     NS_IMETHOD GetMenuItemType(EMenuItemType *aType) = 0;
  127.     
  128.    /**
  129.     * Gets the target for MenuItem
  130.     *
  131.     */
  132.     NS_IMETHOD GetTarget(nsIWidget *& aTarget) = 0;
  133.     
  134.    /**
  135.     * Gets Native Menu Handle
  136.     *
  137.     */
  138.     NS_IMETHOD GetNativeData(void*& aData) = 0;
  139.  
  140.    /**
  141.     * Adds menu listener
  142.     *
  143.     */
  144.     NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
  145.  
  146.    /**
  147.     * Removes menu listener
  148.     *
  149.     */
  150.     NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
  151.  
  152.    /**
  153.     * Indicates whether it is a separator
  154.     *
  155.     */
  156.     NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
  157.  
  158.    /**
  159.     * Executes the "cached" JavaScript Command 
  160.     * @return NS_OK if the command was executed properly, otherwise an error code
  161.     */
  162.     NS_IMETHOD DoCommand() = 0;
  163.  
  164.     /**
  165.     *
  166.     */
  167.     NS_IMETHOD SetModifiers(PRUint8 aModifiers) = 0;
  168.     NS_IMETHOD GetModifiers(PRUint8 * aModifiers) = 0;
  169. };
  170.  
  171. #endif
  172.